package com.zdkj.subway.stm.util;


import com.zdkj.common.core.exceltools.ExcelUtil;
import com.zdkj.common.core.exceltools.IExcelParser;
import com.zdkj.common.core.exceltools.impl.CommonExcelParse;
import com.zdkj.subway.stm.entity.SwStCycle;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.junit.Test;

import java.io.File;
import java.util.List;

/**
 * @ProjectName: zdkj
 * @Package: com.zdkj.subwai.st.test
 * @ClassName: ExcelUtilTest
 * @Description:
 * @Author: kangjian
 * @CreateDate: 2020/1/12 20:52
 * @Version: 1.0
 */
@Slf4j
public class ExcelUtilTest {
    @Test
    public void testExcelImport(){
        String path="C:\\Users\\Administrator\\Desktop\\a.xlsx";
        try {
            File file=new File(path);
            Workbook workbook= ExcelUtil.chooseWorkbook(file);
            Sheet sheet=workbook.getSheetAt(0);
            IExcelParser excelParser=new CommonExcelParse();
            List<SwStCycle> list= excelParser.parse(sheet,new SwStCycle());
            log.info("list={}",list);
        } catch (Exception e) {
           log.error("",e);
        }

    }
}
